<!--
/**
 * moOde audio player (C) 2014 Tim Curtis
 * http://moodeaudio.org
 *
 * (C) 2020 @bitlab (@bitkeeper Git)
 *
 * This Program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This Program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * 汉化：Androidnews
 */
-->
<div id="container">
<div class="container">
	<h1 class="cdsp-config">CamillaDSP</h1>
	<p class="sub-legend>">版本: $_select[version]</p>
	<p>
		CamillaDSP是一款通用数字信号处理（DSP）工具，用于路由和过滤声音。它可用于构建有源扬声器的分频器，执行房间校正、均衡和高分辨率音量控制。
	</p>

	<form class="form-horizontal" action="" method="post" >
		<legend>设置
			<button class="legend-config btn btn-medium btn-primary btn-submit" type="submit" name="save" value="1" $_save_disabled>保存</button>
		</legend>
		<p class="sub-legend $_camilladsp_set_disabled_message">
			要使用CamillaDSP，请关闭音频和多房间配置中的所有其他DSP、EQ和多房间选项。
		</p>

		<div class="config-horiz-rule">常规</div>

		<div class="control-group">
			<label class="control-label" for="cdsp-mode">信号处理</label>
			<div class="controls">
				<select id="cdsp-mode" class="config-select-xxlarge" name="cdsp_mode" $_save_disabled>
					$_select[cdsp_mode]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-mode" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-cdsp-mode" class="config-help-info">
					<b>关:</b> 不会发生信号处理。<br>
					<b>自定义:</b> 手动创建CamillaDSP设置，例如在使用多个输出设备时。<br>
					<b>快速卷积:</b> 使用下面“快速卷积滤波器”中的选项提供带增益的基本卷积。<br>
					<b>配置:</b> 使用列出的管道配置之一。
				</span>
			</div>

			<label class="control-label">默认设备</label>
			<div class="controls">
				<div class="toggle">
					<label class="toggle-radio toggle-cdsp-use-default-device" for="toggle-cdsp-use-default-device-2">开</label>$_select[cdsp_use_default_device_on]
					<label class="toggle-radio toggle-cdsp-use-default-device" for="toggle-cdsp-use-default-device-1">关</label>$_select[cdsp_use_default_device_off]
				</div>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-use-default-device" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span class="config-help-static">
					ALSA: $_alsa_plugin_and_cardnum
				</span>
				<span id="info-cdsp-use-default-device" class="config-help-info">
					<b>开:</b> 使用音频配置中定义的输出设备和模式。<br>
					<b>关:</b>例如，如果要创建多通道交叉，请使用管道编辑器指定不同的设备和模式。
				</span>
			</div>

            <label class="control-label" for="log-level">日志级别</label>
            <div class="controls">
				<select id="log-level" name="log_level" class="config-select-large">
					$_cdsp_log_level
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-log-level" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-log-level" class="config-help-info">
					控制MPD日志中CamillaDSP条目的详细程度。
               </span>
            </div>
		</div>

		<div class="config-horiz-rule">快速卷积滤波器</div>

		<div class="control-group">
			<label class="control-label" for="cdsp-qc-gain">增益(dB)</label>
			<div class="controls">
				<input class="config-input-large" type="number" maxlength="3" min="-40" max="20" step="0.1" id="cdsp-qc-gain" name="cdsp_qc_gain" value="$_cdsp_qc_gain">
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-qc-gain" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-cdsp-qc-gain" class="config-help-info">
					调整增益有助于防止削波。范围是-40dB到20dB。打开管道编辑器以查看信号是否削波或显示滤波器的频率曲线。
				</span>
			</div>

			<label class="control-label" for="cdsp-qc-ir-left">IR left</label>
			<div class="controls">
			    <select id="cdsp-qc-ir-left" class="config-select-xxlarge" name="cdsp_qc_ir_left">
					$_select[cdsp_qc_ir_left]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-qc-ir-left" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-cdsp-qc-ir-left" class="config-help-info">
					选择用于卷积的脉冲响应。可以在文件管理部分添加新的脉冲响应文件。
				</span>
			</div>

			<label class="control-label" for="cdsp-qc-ir-right">IR right</label>
			<div class="controls">
			    <select id="cdsp-qc-ir-right" class="config-select-xxlarge" name="cdsp_qc_ir_right">
					$_select[cdsp_qc_ir_right]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-qc-right" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-cdsp-qc-right" class="config-help-info">
					选择用于卷积的脉冲响应。可以在文件管理部分添加新的脉冲响应文件。
				</span>
			</div>

			<label class="control-label" for="cdsp-qc-ir-type">类型/格式</label>
			<div class="controls">
			    <select id="cdsp-qc-ir-type" class="config-select-large" name="cdsp_qc_ir_type">
					$_select[cdsp_qc_ir_type]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-qc-type" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				$_check_msg_quick_convolution
				<span id="info-cdsp-qc-type" class="config-help-info">
					指定所选脉冲响应文件的类型。注意对于wav文件选择WAVE，没有必要将文件转换为raw。
				</span>
			</div>
		</div>
	</form>

	<form class="form-horizontal" action="#pipeline-editor" method="post">
		<a id="pipeline-editor"></a>

		<legend>管道编辑器
			<a href="cdsp-configeditor.php" target="camillagui"><button class="legend-config btn btn-medium btn-primary" $_open_camillagui_disabled>打开</button></a>
		</legend>

		<div class="control-group">
			<span class="config-help-static $_camillagui_notfound_show" >
				<span style='color: red'>&#10007;</span> 未找到或未安装管道编辑器。
			</span>
			<span class="config-help-static $_camillagui_status_problems">
				<span style='color: red'>&#10007;</span> 管道编辑器出现未知问题。
			</span>

			<label class="control-label">状态</label>
			<div class="controls">
				<div class="toggle">
					<label class="toggle-radio toggle-camillagui" for="toggle-camillagui-2">开</label>$_select[camillagui_on]
					<label class="toggle-radio toggle-camillagui" for="toggle-camillagui-1">关</label>$_select[camillagui_off]
				</div>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-camillagui" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-camillagui" class="config-help-info">
					显示管道编辑器Web服务的当前开/关状态。
				</span>
				<button id="btn-update-camilla-gui" class="btn btn-medium btn-primary btn-submit" type="submit" name="update_camillagui" value="1" style="display:none"/>
			</div>

			<label class="control-label">专家模式</label>
			<div class="controls">
				<div class="toggle">
					<label class="toggle-radio toggle-camillaguiexpert" for="toggle-camillaguiexpert-2">开</label>$_select[camillaguiexpert_on]
					<label class="toggle-radio toggle-camillaguiexpert" for="toggle-camillaguiexpert-1">关</label>$_select[camillaguiexpert_off]
				</div>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-camillaguiexpert" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-camillaguiexpert" class="config-help-info">
					显示高级选项，例如播放/捕获设备设置和重新采样。
				</span>
				<button id="btn-update-camilla-gui-expert" class="btn btn-medium btn-primary btn-submit" type="submit" name="update_camillagui_expert" value="1" style="display:none"/>
			</div>
		</div>
	</form>

	<legend>文件管理</legend>
	<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
		<div class="control-group">
			<label class="control-label" for="cdsp-config">系统配置</label>
			<div class="controls">
			    <select id="cdsp-config" class="config-select-xxlarge" name="cdsp_config" onchange="$('#btn-automatic-check').click();">
					$_select[cdsp_config]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-config" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span class="config-help-static">$_check_msg_config</span>
				<span id="info-cdsp-config" class="config-help-info">
					View the <a class="target-blank-link" href="https://github.com/HEnquist/camilladsp#pipeline" target="_blank">CamillaDSP文档</a> 有关管道配置文件的信息。<br>
					<b>默认配置</b><br>
					<table class="cdsp-help-table">
						<tr><td>ASH-IR R02 Control Room</td><td>双耳室脉冲响应R02来自ASH-IR数据集的控制室（无HpCF）</td></tr>
						<tr><td>Crossfeed Bs2b</td><td>Bs2b，其中包含5个设定集。有关详细信息，请参阅链接</td></tr>
						<tr><td>Crossfeed Mikhail</td><td>Mikhail Naganov，使用自己的IR校正进行定制</td></tr>
						<tr><td>Crossfeed MPM</td><td>Mikhail Phonitor Mini (MPM)。 Mikhail Naganov对SPL Phonitor Mini Crossfeed进行逆向工程，采用Ebert-Hanke的DSP</td></tr>
						<tr><td>Crossfeed Natural</td><td>Ebert Hanke对Natural的实现大致模仿了Jan Meier的一些出版物</td></tr>
						<tr><td>Crossfeed Chu Moy</td><td>基于Linkwitz的Pow-Chu-Moy Crossfeed的Ebert-Hanke实现</td></tr>
						<tr><td>Flat</td><td>空配置（无DSP）</td></tr>
						<tr><td>Loudness</td><td>具有3dB高升压、6dB低升压和-3dB增益的音量曲线</td></tr>
						<tr><td>MS-Matrix Narrow</td><td>侧边信号减少的M-S（中间侧）矩阵</td></tr>
						<tr><td>MS-Matrix Wide</td><td>增加侧边信号的M-S（中间侧）矩阵</td></tr>
						<tr><td>PEQ 10-Band</td><td>10波段参数均衡器的一般示例</td></tr>
						<tr><td>Polarity Inversion</td><td>反转通道+/-极性</td></tr>
						<tr><td>Polarity Inversion with VC</td><td>反转通道+/-极性并使用CamillaDSP音量控制</td></tr>
						<tr><td>Trifield 3-channel</td><td>Michael Gerzon 衍生的 Trifield 解码器。需要至少 3 个通道可用于输出</td></tr>
						<tr><td>volume control</td><td>CamillaDSP音量控制</td></tr>
					</table>
				</span>
				<button id="btn-automatic-check" class="btn btn-medium btn-primary btn-submit" type="submit" name="check_auto" value="1"  style="display:none" ></button>
			</div>

			<div class="controls">
				<a data-toggle="modal" href="#remove-pipeline"><button class="btn btn-medium btn-primary config-btn">移除</button></a>
				<a data-toggle="modal" href="#copy-pipeline"><button class="btn btn-medium btn-primary config-btn">复制</button></a>
				<a data-toggle="modal" href="#create-new-pipeline"><button class="btn btn-medium btn-primary config-btn">新建</button></a>
				<button class="btn btn-medium btn-primary config-btn" type="submit" name="export" value="1">下载</button>

				<label for="pipeline-config" id="choose-pipeline-cfg" class="btn btn-primary btn-medium config-btn">上传</label>
				<input type="file" id="pipeline-config" accept=".yml" name="pipeline_config" style="display:none" onchange="$('#btn-import-pipeline').click();" >
				<button id="btn-import-pipeline" class="btn btn-medium btn-primary btn-submit" type="submit" name="import" value="1"  style="display:none"/>

				<button class="btn btn-medium btn-primary btn-submit config-btn" type="submit" name="check" value="1">检查</button>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-configuration-actions" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<span id="info-configuration-actions" class="config-help-info">
					<b>移除:</b> 删除所选配置文件。<br>
					<b>复制:</b> 将所选配置文件复制到具有不同名称的新文件中。<br>
					<b>新建:</b> 创建一个具有最低要求设置的新配置。<br>
					<b>下载:</b> 下载所选配置文件。<br>
					<b>上传:</b> 上载配置文件。如果该文件已经存在，它将被覆盖。<br>
					<b>检查:</b> 检查所选配置是否有效。
					<br><br>
					<b>使用说明:</b><br>
					暂停/停止播放后，对配置的更改会立即生效。如果卡米拉不能播放音频，错误将被报告到MPD日志中 <code>/var/log/mpd/log</code>
					如果这是由于信道音频设备不支持计数或采样率，请调整CamillaDSP混音器或采样器或进行更改在ALSA配置文件中传递给CamillaDSP的音频格式 <code>/etc/alsa/conf.d/camilladsp.conf</code>
					该文件中的错误通常在 <code>/var/log/moode.log</code> and <code>/var/log/syslog</code>中报告
				</span>
			</div>
		</div>
	</form>

	<form class="form-horizontal" action="#conv-file" method="post" enctype="multipart/form-data">
		<a id="conv-file"></a>

		<div class="control-group">
			<label class="control-label" for="cdsp-coeffs">卷积</label>
			<div class="controls" >
				<select id="cdsp-coeffs" class="config-select-xxlarge" name="cdsp_coeffs" onchange="$('#coeff_remove_id').val($('#cdsp-coeffs :selected').val() );$('#btn-check-coeff').click();">
					$_select[cdsp_coeffs]
				</select>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-cdsp-coeffs" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<div id="info-cdsp-coeffs" class="config-help-info">
					查看 <a class="target-blank-link" href="https://github.com/HEnquist/camilladsp#fir" target="_blank">CamillaDSP文档</a>有关脉冲响应文件的信息。<br>
 			    </div>
				<span class="config-help-static">
					<table class="cdsp-help-table">
						$_coeff_info_html
					</table>
				</span>
			</div>

			<!-- ids and names aren't correct: (copy of above now)-->
			<div class="controls">
				<a data-toggle="modal" href="#remove-coeff"><button class="btn btn-medium btn-primary config-btn">移除</button></a>
				<button class="btn btn-medium btn-primary config-btn config-btn" type="submit" name="export" value="1">下载</button>
				<label for="coeffs-file" id="choose-coeff-cfg" class="btn btn-medium btn-primary config-btn">上传</label>
				<input type="file" id="coeffs-file" accept=".wav,.txt,.raw,.csv" name="coeffs_file" style="display:none" onchange="$('#btn-import-coeff').click();">
				<button id="btn-import-coeff" class="btn btn-medium btn-primary  config-btn btn-submit" type="submit" name="import" value="1"  style="display:none"</button>
				<button id="btn-check-coeff" class="btn btn-medium btn-primary config-btn btn-submit" type="submit" name="info" value="1" style="display:none">信息</button>
				<a aria-label="Help" class="config-info-toggle" data-cmd="info-convolution-actions" href="#notarget"><i class="fa-solid fa-sharp fa-info-circle"></i></a>
				<div id="info-convolution-actions" class="config-help-info">
					<b>移除:</b> 删除选定的卷积文件。<br>
					<b>下载:</b> 下载选定的卷积文件。<br>
					<b>上传:</b> 上传一个卷积文件。如果该文件已经存在，它将被覆盖。
 			    </div>
			</div>
		</div>
	</form>

	<form class="form-horizontal $_cdsp_extensions_show" action="#extensions" method="post" >
		<a id="extensions"></a>
		<legend>扩展</legend>
		<div class="control-group">
			$extensions_html
		</div>
	</form>

</div>
</div>

<form class="form-horizontal" method="post">
	<div id="remove-pipeline" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="remove-pipeline-label" aria-hidden="true">
		<input id="config_remove_id" type="hidden" name="cdsp_config" value="$_selected_config"/>
		<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h3>移除配置？</h3>
		</div>
		<div class="modal-body txtmid">
			<h4>$_selected_config</h4>
			<span class="config-help-static">
				$_disable_rm_msg
			</span>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
			<button class="btn btn-primary btn-submit" type="submit" name="remove" value="1" $_disable_rm>是</button>
		</div>
	</div>
</form>

<form class="form-horizontal" method="post">
	<div id="remove-coeff" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="remove-coeff-label" aria-hidden="true">
		<input id="coeff_remove_id" type="hidden" name="cdsp_coeffs" value="$_selected_coeff"/>
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h3>移除卷积？</h3>
		</div>
		<div class="modal-body txtmid">
			<h4>$_selected_coeff</h4>
			<span class="config-help-static">
				$_disable_rm_msg
			</span>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
			<button class="btn btn-primary btn-submit" type="submit" name="remove" value="1" $_disable_rm>是</button>
		</div>
	</div>
</form>

<form class="form-horizontal" method="post">
	<div id="copy-pipeline" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="copy-pipeline-label" aria-hidden="true">
		<input type="hidden" name="cdsp_config" value="$_selected_config"/>
		<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h3>复制管道？</h3>
		</div>
		<div class="modal-body">
			<div class="control-group">
				<div class="control-group">
					<label class="control-label" for="selected-pipeline-name">从</label>
					<div class="controls">
						<input id="selected-pipeline-name" class="config-modal-input" type="text" value="$_selected_config" readonly>
					</div>
					<label class="control-label" for="copyto-pipeline-name">到</label>
					<div class="controls">
						<input id="copyto-pipeline-name" class="config-modal-input" type="text" pattern="[A-Za-z0-9 \-_]*" name="copyto_pipeline_name" value="" autofocus>
					</div>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
			<button class="btn btn-primary btn-submit" type="submit" name="copy_pipeline" value="1">是</button>
		</div>
	</div>
</form>

<form class="form-horizontal" method="post">
	<div id="create-new-pipeline" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="new-pipeline-label" aria-hidden="true">
		<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h3>创建新管道？</h3>
		</div>
		<div class="modal-body">
			<div class="control-group">
				<label class="control-label" for="new-pipeline-name">名称</label>
				<div class="controls">
					<input class="config-modal-input" type="text" pattern="[A-Za-z0-9 \-_]*" id="new-pipeline-name" name="new_pipeline_name" value="" autofocus>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
			<button class="btn btn-primary btn-submit" type="submit" name="create_new_pipeline" value="1">是</button>
		</div>
	</div>
</form>
